﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:local="clr-namespace:OMANE.Modules.Indicateurs"
    xmlns:converters="clr-namespace:OMANE.Modules.Indicateurs.Views.Converters"
    xmlns:selectors="clr-namespace:OMANE.Modules.Indicateurs.Views.Selectors"
	xmlns:ig="http://schemas.infragistics.com/xaml"    
	mc:Ignorable="d"
	x:Class="Views.ViewGraphEditor"
	>

    <UserControl.Resources>
        <converters:InvertConverter x:Key="Inverter" />
    </UserControl.Resources>
    <Grid>
        <TabControl >
            <TabItem Header="Positionnement">
                <Grid Background="#FFE5E5E5" >
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
						<RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
						<RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition Width="5"/>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <GridSplitter HorizontalAlignment="Stretch" Grid.Column="1" Grid.RowSpan="8" />
                    <Grid >
                        <TextBlock Text="Largeur" />
                    </Grid>
                    <Grid Grid.Column="2" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=WidthAuto, Mode=TwoWay, Converter={StaticResource Inverter}}" >
                            <TextBox IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}" Text="{Binding Path=Width}"/>
                        </CheckBox>
                    </Grid>
                    <Grid Grid.Row="1" >
                        <TextBlock Text="Hauteur" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="1" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=HeightAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                            <TextBox IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  Text="{Binding Path=Height}"/>
                        </CheckBox>
                    </Grid>
                    <Grid Grid.Row="2" >
                        <TextBlock Text="Gauche" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="2" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=LeftAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                            <TextBox IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  Text="{Binding Path=Left}"/>
                        </CheckBox>
                    </Grid>
                    <Grid  Grid.Row="3" >
                        <TextBlock Text="Haut" />
                    </Grid>
                    <Grid Grid.Column="2"  Grid.Row="3" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=TopAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                            <TextBox IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  Text="{Binding Path=Top}"/>
                        </CheckBox>
                    </Grid>
                    <Grid Grid.Row="4" >
                        <TextBlock Text="Droite" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="4" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=RightAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                            <TextBox IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  Text="{Binding Path=Right}"/>
                        </CheckBox>
                    </Grid>
                    <Grid Grid.Row="5" >
                        <TextBlock Text="Bas" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="5" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=BottomAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                            <TextBox IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  Text="{Binding Path=Bottom}"/>
                        </CheckBox>
                    </Grid>
                    <Grid Grid.Row="6" >
                        <TextBlock Text="Alignement Horizontal" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="6" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=HAlignAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                            <ComboBox SelectedIndex="{Binding Path=HAlign}" IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  >
                                <sys:String>A Gauche</sys:String>
                                <sys:String>Centré</sys:String>
                                <sys:String>A Droite</sys:String>
                                <sys:String>Plein</sys:String>
                            </ComboBox>
                        </CheckBox>
                    </Grid>
                    <Grid Grid.Row="7" >
                        <TextBlock Text="Alignement Vertical" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="7" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=VAlignAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                            <ComboBox SelectedIndex="{Binding Path=VAlign}" IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}">
                                <sys:String>En Haut</sys:String>
                                <sys:String>Centré</sys:String>
                                <sys:String>En Bas</sys:String>
                                <sys:String>Plein</sys:String>
                            </ComboBox>
                        </CheckBox>
                    </Grid>
					 <Grid Grid.Row="8" >
                        <TextBlock Text="Couleur Arriere-Plan" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="8" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=BackColorAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                           <ig:XamColorPicker IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}" SelectedColor="{Binding Path=BackColor, Mode=TwoWay}" />
                        </CheckBox>
                    </Grid>
					 <Grid Grid.Row="9" >
                        <TextBlock Text="Couleur Bordure" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="9" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=BorderColorAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                             <ig:XamColorPicker IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  SelectedColor="{Binding Path=BorderColor, Mode=TwoWay}" />
                        </CheckBox>
                    </Grid>
					 <Grid Grid.Row="10" >
                        <TextBlock Text="Epaisseur Bordure" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="10" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=BorderSizeAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                           <TextBox IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  Text="{Binding Path=BorderSize}"/>
                        </CheckBox>
                    </Grid>
					 <Grid Grid.Row="11" >
                        <TextBlock Text="Rayon Bordure" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="11" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=CornerRadiusAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                             <TextBox IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  Text="{Binding Path=CornerRadius}"/>
                         </CheckBox>
                    </Grid>
                </Grid>
            </TabItem>
            <TabItem Header="Données">
                <Grid Background="#FFE5E5E5">
                    <ContentPresenter  Content="{Binding}">
                        <ContentPresenter.Resources>
                            <DataTemplate x:Key="vmchartzone">
                                <Grid d:DesignWidth="175.897" d:DesignHeight="89.88">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition/>
                                    </Grid.RowDefinitions>
                                    <TextBlock Text="Label" Margin="0,0,5,0" VerticalAlignment="Center" />
                                    <TextBox Text="{Binding Path=DetailInstance.Label}" Grid.Column="1" Grid.ColumnSpan="4">
                                    	<TextBox.ContextMenu>
                                    		<ContextMenu>
                                                <MenuItem Header="Variables" DisplayMemberPath="Caption" ItemsSource="{Binding Source={x:Static local:TestData.ModelVariables}}">
                                                    <MenuItem.ItemContainerStyle>
                                                        <Style TargetType="MenuItem">
                                                            <EventSetter Event="Click" Handler="VariablesInsertion" />
                                                        </Style>
                                                    </MenuItem.ItemContainerStyle>
                                                </MenuItem>
                                                <MenuItem Header="Fonctions">
                                                    <MenuItem Header="Log" />
                                                    <MenuItem Header="Exp" />
                                                    <MenuItem Header="Pow" />
                                                    <MenuItem Header="Date" >
                                                        <MenuItem Header="Annee" />
                                                        <MenuItem Header="Mois" />
                                                        <MenuItem Header="Jour" />

                                                    </MenuItem>

                                                </MenuItem>
                                                <MenuItem Header="Operateurs">
                                                    <MenuItem Header="+" />
                                                    <MenuItem Header="-" />
                                                    <MenuItem Header="*" />
                                                    <MenuItem Header="/" />
                                                    <MenuItem Header="=" />
                                                    <MenuItem Header="!=" />
                                                    <MenuItem Header="Et" />
                                                    <MenuItem Header="Ou" />
                                                    <MenuItem Header="Not" />
                                                    <MenuItem Header="Mod" />
                                                </MenuItem>
                                            </ContextMenu>
                                    	</TextBox.ContextMenu>
                                    </TextBox>
                                    <TextBlock Text="Value X" Grid.Row="1" Margin="0,0,5,0" VerticalAlignment="Center" />
                                    <TextBox Text="{Binding Path=DetailInstance.ValueX}" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="4">
                                    	<TextBox.ContextMenu>
                                    		<ContextMenu>
                                                <MenuItem Header="Variables" DisplayMemberPath="Caption" ItemsSource="{Binding Source={x:Static local:TestData.ModelVariables}}">
                                                    <MenuItem.ItemContainerStyle>
                                                        <Style TargetType="MenuItem">
                                                            <EventSetter Event="Click" Handler="VariablesInsertion" />
                                                        </Style>
                                                    </MenuItem.ItemContainerStyle>
                                                </MenuItem>
                                                <MenuItem Header="Fonctions">
                                                    <MenuItem Header="Log" />
                                                    <MenuItem Header="Exp" />
                                                    <MenuItem Header="Pow" />
                                                    <MenuItem Header="Date" >
                                                        <MenuItem Header="Annee" />
                                                        <MenuItem Header="Mois" />
                                                        <MenuItem Header="Jour" />

                                                    </MenuItem>

                                                </MenuItem>
                                                <MenuItem Header="Operateurs">
                                                    <MenuItem Header="+" />
                                                    <MenuItem Header="-" />
                                                    <MenuItem Header="*" />
                                                    <MenuItem Header="/" />
                                                    <MenuItem Header="=" />
                                                    <MenuItem Header="!=" />
                                                    <MenuItem Header="Et" />
                                                    <MenuItem Header="Ou" />
                                                    <MenuItem Header="Not" />
                                                    <MenuItem Header="Mod" />
                                                </MenuItem>
                                            </ContextMenu>
                                    	</TextBox.ContextMenu>
                                    </TextBox>
                                    <TextBlock Text="Value Y" Grid.Row="2" Margin="0,0,5,0" VerticalAlignment="Center" />
                                    <ComboBox Grid.Row="2" Grid.Column="1" 
									  ItemsSource="{Binding Path=DetailInstance.Series}" 
									  SelectedItem="{Binding Path=DetailInstance.ActiveSerie}" DisplayMemberPath="ShowName" >
                                    	<ComboBox.Visibility>
                                    		<Binding Path="DetailInstance.HaveSerie">
                                    			<Binding.Converter>
                                    				<BooleanToVisibilityConverter />                        			
												</Binding.Converter>                         		
											</Binding>                          	
										</ComboBox.Visibility>                         
									  </ComboBox>
									<Button Command="{Binding Path=DetailInstance.DeleteSerieCommand}" Content="-" Grid.Row="2" Grid.Column="3" FontSize="16" FontFamily="Showcard Gothic" Height="26" Width="26">
										<Button.Visibility>
											<Binding Path="DetailInstance.HaveSerie">
                                    			<Binding.Converter>
                                    				<BooleanToVisibilityConverter />                        			
												</Binding.Converter>                         		
											</Binding>  
										</Button.Visibility>
									</Button>
									<Button Command="{Binding Path=DetailInstance.AddSerieCommand}" Content="+" Grid.Row="2" Grid.Column="4" FontSize="16" FontFamily="Showcard Gothic" Width="26" Height="26" >
										  										
									</Button>
								    <TextBox Text="{Binding Path=DetailInstance.ValueY}" Grid.Column="2" Grid.Row="2" Grid.ColumnSpan="1">
                                        <TextBox.ContextMenu>
                                            <ContextMenu>
                                                <MenuItem Header="Variables" DisplayMemberPath="Caption" ItemsSource="{Binding Source={x:Static local:TestData.ModelVariables}}">
                                                    <MenuItem.ItemContainerStyle>
                                                        <Style TargetType="MenuItem">
                                                            <EventSetter Event="Click" Handler="VariablesInsertion" />
                                                        </Style>
                                                    </MenuItem.ItemContainerStyle>
                                                </MenuItem>
                                                <MenuItem Header="Fonctions">
                                                    <MenuItem Header="Log" />
                                                    <MenuItem Header="Exp" />
                                                    <MenuItem Header="Pow" />
                                                    <MenuItem Header="Date" >
                                                        <MenuItem Header="Annee" />
                                                        <MenuItem Header="Mois" />
                                                        <MenuItem Header="Jour" />

                                                    </MenuItem>

                                                </MenuItem>
                                                <MenuItem Header="Operateurs">
                                                    <MenuItem Header="+" />
                                                    <MenuItem Header="-" />
                                                    <MenuItem Header="*" />
                                                    <MenuItem Header="/" />
                                                    <MenuItem Header="=" />
                                                    <MenuItem Header="!=" />
                                                    <MenuItem Header="Et" />
                                                    <MenuItem Header="Ou" />
                                                    <MenuItem Header="Not" />
                                                    <MenuItem Header="Mod" />
                                                </MenuItem>
                                            </ContextMenu>
                                        </TextBox.ContextMenu>
                                    </TextBox>

                                    <Grid>

                                    </Grid>
                                </Grid>
                            </DataTemplate>
                        </ContentPresenter.Resources>
                        <ContentPresenter.ContentTemplateSelector>
                            <selectors:ChartZoneTemplateSelector />
                        </ContentPresenter.ContentTemplateSelector>
                    </ContentPresenter>
                </Grid>
            </TabItem>
            <TabItem Header="Detail">
                <Grid Background="#FFE5E5E5">
                    <ContentControl Content="{Binding Detail}" />
                </Grid>
            </TabItem>
        </TabControl>
    </Grid>
</UserControl>